import Vue from 'vue'
import Vuex from 'vuex'
import state from './state'
import mutations from './mutations'

const detailcart = store => {
    store.subscribe((mutation, state) => {
        window.localStorage.setItem('xxxx-cart', JSON.stringify(state.cart))
    })
}
const loginuser = store => {
    store.subscribe((mutation, state) => {
      window.localStorage.setItem('xxxx-user', JSON.stringify(state.users))
    })
  }

Vue.use(Vuex)
export default new Vuex.Store({
    strict: true,
    state,
    mutations,
    plugins:[detailcart,loginuser]
})